/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.agreement.entity.serviceinvoice;

import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.mapper.query.QueryType;
import com.jeesite.modules.base.entity.customer.Customer;
import com.jeesite.modules.base.entity.guarantor.Guarantor;
import com.jeesite.modules.sys.entity.Company;
import org.hibernate.validator.constraints.Length;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.List;
import com.jeesite.common.collect.ListUtils;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;

/**
 * 服务发票Entity
 * @author shengbin
 * @version 2021-03-04
 */
@Table(name="t_service_invoice", alias="a", columns={
		@Column(name="service_invoice_id", attrName="serviceInvoiceId", label="服务发票ID", isPK=true),
		@Column(name="service_order_id", attrName="serviceOrderId", label="服务订单编号",queryType = QueryType.LIKE),
		@Column(name="customer_id", attrName="customerId", label="客户"),
		@Column(name="date", attrName="date", label="日期"),
		@Column(name="create_by", attrName="createBy", label="创建者", isUpdate=false),
		@Column(name="create_date", attrName="createDate", label="创建时间", isUpdate=false, isQuery=false),
		@Column(name="update_by", attrName="updateBy", label="更新者", isQuery=false),
		@Column(name="update_date", attrName="updateDate", label="更新时间", isQuery=false),
		@Column(name="remarks", attrName="remarks", label="备注信息", isQuery=false,queryType = QueryType.LIKE),
},joinTable={
		@JoinTable(type= JoinTable.Type.LEFT_JOIN, entity= Customer.class, attrName="customer", alias="u12",
				on="u12.customer_id = a.customer_id", columns={
				@Column(name="customer_id", label="客户编码", isPK=true),
				@Column(name="customer_name", label="客户名称", isQuery=false),
		}),
		/*@JoinTable(type= JoinTable.Type.LEFT_JOIN, entity= TserviceInvoiceDetail.class, attrName="tserviceInvoiceDetail", alias="b",
				on="b.service_invoice_id = a.service_invoice_id", columns={
				@Column(name="invoice_date", label="发票日期", isQuery=false),
		}),*/
},orderBy="a.update_date DESC"
)
public class TserviceInvoice extends DataEntity<TserviceInvoice> {
	
	private static final long serialVersionUID = 1L;
	private String serviceInvoiceId;		// 服务发票ID
	private String serviceOrderId;		// 服务订单编号
	private String customerId;		// 客户
	private String customerName;		// 客户
	private Date date;		// 日期
	private Customer customer;
	private TserviceInvoiceDetail tserviceInvoiceDetail;		// 发票日期
	private List<TserviceInvoiceDetail> tserviceInvoiceDetailList = ListUtils.newArrayList();		// 子表列表

	public TserviceInvoice() {
		this(null);
	}

	public TserviceInvoice(String id){
		super(id);
	}
	
	public String getServiceInvoiceId() {
		return serviceInvoiceId;
	}

	public void setServiceInvoiceId(String serviceInvoiceId) {
		this.serviceInvoiceId = serviceInvoiceId;
	}
	
	@Length(min=0, max=64, message="服务订单编号长度不能超过 64 个字符")
	public String getServiceOrderId() {
		return serviceOrderId;
	}

	public void setServiceOrderId(String serviceOrderId) {
		this.serviceOrderId = serviceOrderId;
	}
	
	@Length(min=0, max=64, message="客户长度不能超过 64 个字符")
	public String getCustomerId() {
		return customerId;
	}

	public void setCustomerId(String customerId) {
		this.customerId = customerId;
	}

	public Date getDate_gte() {
		return sqlMap.getWhere().getValue("date", QueryType.GTE);
	}

	public void setDate_gte(Date date) {
		sqlMap.getWhere().and("date", QueryType.GTE, date);
	}

	public Date getDate_lte() {
		return sqlMap.getWhere().getValue("date", QueryType.LTE);
	}

	public void setDate_lte(Date date) {
		sqlMap.getWhere().and("date", QueryType.LTE, date);
	}


	public List<TserviceInvoiceDetail> getTserviceInvoiceDetailList() {
		return tserviceInvoiceDetailList;
	}

	public void setTserviceInvoiceDetailList(List<TserviceInvoiceDetail> tserviceInvoiceDetailList) {
		this.tserviceInvoiceDetailList = tserviceInvoiceDetailList;
	}

	public TserviceInvoiceDetail getTserviceInvoiceDetail() {
		return tserviceInvoiceDetail;
	}

	public void setTserviceInvoiceDetail(TserviceInvoiceDetail tserviceInvoiceDetail) {
		this.tserviceInvoiceDetail = tserviceInvoiceDetail;
	}
	public Date getCreateDate_gte() {
		return sqlMap.getWhere().getValue("create_date", QueryType.GTE);
	}

	public void setCreateDate_gte(Date createDate) {
		sqlMap.getWhere().and("create_date", QueryType.GTE, createDate);
	}

	public Date getCreateDate_lte() {
		return sqlMap.getWhere().getValue("create_date", QueryType.LTE);
	}

	public void setCreateDate_lte(Date createDate) {
		sqlMap.getWhere().and("create_date", QueryType.LTE, createDate);
	}

	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String getCustomerName() {
		return customerName;
	}

	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}
}